import {fileURLToPath, URL} from 'node:url'

import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import {ElementPlusResolver} from 'unplugin-vue-components/resolvers'

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [
        vue(),
        AutoImport({
            resolvers: [ElementPlusResolver()],
        }),
        Components({
            resolvers: [ElementPlusResolver()],
        }),
    ],
    resolve: {
        alias: {
            '@': fileURLToPath(new URL('./src', import.meta.url))
        }
    },
    // 如果想要配置访问地址统一前缀在这配置，比如ip:port/myapp/...，想要配置统一前缀myapp,则需要配置publicPath: '/myapp'
    publicPath: '/'
    // server:{
    //     host:'192.168.138.138' ,//ip地址
    //     port: 80, // 设置服务启动端口号
    //     open: false, // 设置服务启动时是否自动打开浏览器
    // }

})
